#include "Panel.h"

#include <glm\gtc\matrix_transform.hpp>


void Panel::init(const glm::vec3 &DireccionLuz) {
	this->m_cubo.init(DireccionLuz, "LightShadowShader.vert", "LightShadowShader.frag");	/*
	this->m_cubo.init(DireccionLuz, "ShadowRealmShader.vert", "ShadowRealmShader.frag");	// */

	this->m_cubo.setMaterial( glm::vec3(0.9f, 0.69f, 0.055f), glm::vec3(0.25f, 0.2f, 0.014f), glm::vec3(0.9f, 0.69f, 0.055f), 16.0f );
}


void Panel::renderizar(const glm::mat4 &matVista, const glm::mat4 &matProyeccion, const glm::mat4 &matModelo) const {
	// La barra horizontal
	glm::mat4 matHorizontal = glm::scale(matModelo, glm::vec3(1.0f, 0.1f, 0.1f));
	matHorizontal = glm::translate(matHorizontal, glm::vec3(0.0f, 0.0f, 1.0f));
	this->m_cubo.renderizar(matVista, matProyeccion, matHorizontal);

	// La barra vertical
	glm::mat4 matVertical = glm::translate(matModelo, glm::vec3(-1.0f, 0.0f, 1.0f));
	matVertical = glm::scale(matVertical, glm::vec3(0.11f, 0.11f, 1.0f));
	this->m_cubo.renderizar(matVista, matProyeccion, matVertical);

	// La barra diagonal
	glm::mat4 matDiagonal = glm::translate(matModelo, glm::vec3(0.0f, 0.0f, 1.0f));
	matDiagonal = glm::rotate(matDiagonal, 45.0f, glm::vec3(0.0f, 1.0f, 0.0f));
	matDiagonal = glm::scale(matDiagonal, glm::vec3(0.1f, 0.1f, 1.3f));	// 1.3 ~= sqrt(2); asi queda mejor la escena
	this->m_cubo.renderizar(matVista, matProyeccion, matDiagonal);
}


